﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bank
{
    abstract class Account : IDepositable, IInterestable
    {
        private Customer customer;
        private double balance;
        private double interestRate;
        public Customer Customer
        {
            get { return this.customer; }
        }
        public double Balance
        {
            get { return this.balance; }
            protected set
            {
                this.balance = value;
            }
        }
        public double InterestRate
        {
            get { return this.interestRate; }
        }

        public Account(Customer customer, double balance, double interestRate)
        {
            this.customer = customer;
            this.balance = balance;
            this.interestRate = interestRate;
        }

        public void DepositAmount(double amount)
        {
            this.Balance += amount;
        }
        public virtual double CalculateInterest(int months)
        {
            if (months <= 0)
            {
                throw new ArgumentOutOfRangeException("invalid account range (months < 0)");
            }
            else
            {

                return months * this.InterestRate;
            }
        }


    }
}
